home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / Plurals / proc_pair.h < prev    next >
C/C++ Source or Header  |  1992-01-27  |  3KB  |  102 lines

  1. /*
  2.  *    Paired Processors
  3.  *
  4.  *    Author:    S.C.Merrall
  5.  *
  6.  *    File:    proc_pair.h
  7.  *
  8.  *    Contents:    Definitions and Declarations
  9.  *
  10.  *    Description:    The paired processors suuplys a set of macros which
  11.  *            are used in place of references to iproc, nproc etc.
  12.  *            There will also be versions of the Xnet statements
  13.  *            At the moment there is a new version of seq_net
  14.  *            called pair_seq_net. The affect is the array has half 
  15.  *            as many elements (but sort of twice as much memory)
  16.  *            This has been devised to for a garbage collector 
  17.  *            using a stop and copy mecahnsim bewteen the `on'
  18.  *            `off' processor sets. The processor sets are then
  19.  *            exchanged
  20.  *
  21.  *    Change History:
  22.  *
  23.  *    Date   Name Comment
  24.  *    -------- ---- -------
  25.  *    17:01:92 SCM  Created
  26.  *
  27.  */
  28.  
  29. /*  Paired Processor Initialisation Function */
  30. /*  ====== ========= ============== ======== */
  31.  
  32. #ifdef __STDC__
  33.  
  34. extern void init_proc_pair( void );
  35.  
  36. #else
  37.  
  38. extern void init_proc_pair( );
  39.  
  40. #endif
  41.  
  42.  
  43. /*  External Declarartions of Globals */
  44. /*  ======== ============= == ======= */
  45.  
  46. /*  Accessible to Programmer */
  47.  
  48. extern plural int PP_iproc;
  49. extern int PP_nproc;
  50.  
  51. extern plural int PP_ixproc;
  52. extern int PP_nxproc;
  53.  
  54. extern plural int PP_iyproc;
  55. extern int PP_nyproc;
  56.  
  57. /*  Internal Only */
  58.  
  59. extern int PP_left_right_proc;
  60. extern plural int PP_active_set;
  61. extern plural int PP_which_way; 
  62.  
  63. /*  Macros and Constants */
  64. /*  ====== === ========= */
  65.  
  66. #define PP_proc(PROC) proc[((PROC)*2)+PP_left_right_proc]
  67.  
  68. #define PP_router(PROCS) router[((PROCS)*2)+PP_left_right_proc]
  69.  
  70. #define PP_xnetN(DIST) xnetN[DIST]
  71. #define PP_xnetS(DIST) xnetS[DIST]
  72. #define PP_xnetW(DIST) xnetW[(DIST)*2]
  73. #define PP_xnetE(DIST) xnetE[(DIST)*2]
  74.  
  75.  
  76. #define PP_on_set()  if (PP_active_set)
  77. #define PP_off_set() if (!PP_active_set)
  78.  
  79. #define PP_LEFT 0
  80. #define PP_RIGHT 1
  81.  
  82. /*  Communications :    There are two macros which are used to pass values
  83.  *            between the two sets of processors, they will pass
  84.  *            data in the correct direction depending on which
  85.  *            set is active.
  86.  *  
  87.  *  PP_push_to:        This is used to write values from the active set 
  88.  *            into the inactive set.
  89.  *  PP_pull_to:            THis is used to read value from the inactive set
  90.  *            In both cases the destination, i.e. where the values
  91.  *            are going to be written is the first argument.
  92.  */
  93.  
  94. #define PP_push_to(DEST,VALUE) if (PP_which_way) xnetE[1].DEST = VALUE; \
  95.                       else xnetW[1].DEST = VALUE
  96.  
  97. #define PP_pull_to(DEST,VALUE) (DEST=((PP_which_way) ? xnetE[1].VALUE \
  98.                                      : xnetW[1].VALUE))
  99.  
  100. #define PP_switch() PP_left_right_proc=(PP_left_right_proc+1)%2; \
  101.             PP_active_set=!PP_active_set
  102.